package org.tigris.atlas.webservice.proxy;

import java.io.IOException;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.tigris.atlas.uddi.weblogic.Inquiry;


/**
 * Servlet implementation class for Servlet: WebServiceProxy
 *
 */
 public class WebServiceProxy extends javax.servlet.http.HttpServlet implements javax.servlet.Servlet {
	 
	 private static final String BUSINESS_NAME = "businessName";
	 private static final String SERVICE_NAME = "serviceName";
	 
    /* (non-Java-doc)
	 * @see javax.servlet.http.HttpServlet#HttpServlet()
	 */
	public WebServiceProxy() {
		super();
	}   	
	
	/* (non-Java-doc)
	 * @see javax.servlet.http.HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
	 */
	protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
	
		String businessName = (String) request.getParameter( BUSINESS_NAME );
		String serviceName  = (String) request.getParameter( SERVICE_NAME );
		
		String wsrpURI = Inquiry.findServiceEndpoint( businessName, serviceName );
		
		response.sendRedirect( wsrpURI );
	}  	
	
}